package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.Objects;

@Entity
@Table(name = "put_in_storage", schema = "jinsanjiao", catalog = "")
public class PutInStorage {
    private int inStorageId;
    private Long inStorageQuantity;
    private Timestamp inStorageTime;
    private Integer inStorageBatch;
    private String inStorageAcceptance;
    private String inStorageReview;
    private Collection<PutInStorageDetails> putInStorageDetailsByInStorageId;

    @Id
    @Column(name = "in_storage_id", nullable = false)
    public int getInStorageId() {
        return inStorageId;
    }

    public void setInStorageId(int inStorageId) {
        this.inStorageId = inStorageId;
    }

    @Basic
    @Column(name = "in_storage_quantity", nullable = true, precision = 0)
    public Long getInStorageQuantity() {
        return inStorageQuantity;
    }

    public void setInStorageQuantity(Long inStorageQuantity) {
        this.inStorageQuantity = inStorageQuantity;
    }

    @Basic
    @Column(name = "in_storage_time", nullable = true)
    public Timestamp getInStorageTime() {
        return inStorageTime;
    }

    public void setInStorageTime(Timestamp inStorageTime) {
        this.inStorageTime = inStorageTime;
    }

    @Basic
    @Column(name = "in_storage_batch", nullable = true)
    public Integer getInStorageBatch() {
        return inStorageBatch;
    }

    public void setInStorageBatch(Integer inStorageBatch) {
        this.inStorageBatch = inStorageBatch;
    }

    @Basic
    @Column(name = "in_storage_acceptance", nullable = true, length = 30)
    public String getInStorageAcceptance() {
        return inStorageAcceptance;
    }

    public void setInStorageAcceptance(String inStorageAcceptance) {
        this.inStorageAcceptance = inStorageAcceptance;
    }

    @Basic
    @Column(name = "in_storage_review", nullable = true, length = 20)
    public String getInStorageReview() {
        return inStorageReview;
    }

    public void setInStorageReview(String inStorageReview) {
        this.inStorageReview = inStorageReview;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PutInStorage that = (PutInStorage) o;
        return inStorageId == that.inStorageId &&
                Objects.equals(inStorageQuantity, that.inStorageQuantity) &&
                Objects.equals(inStorageTime, that.inStorageTime) &&
                Objects.equals(inStorageBatch, that.inStorageBatch) &&
                Objects.equals(inStorageAcceptance, that.inStorageAcceptance) &&
                Objects.equals(inStorageReview, that.inStorageReview);
    }

    @Override
    public int hashCode() {
        return Objects.hash(inStorageId, inStorageQuantity, inStorageTime, inStorageBatch, inStorageAcceptance, inStorageReview);
    }

    @OneToMany(mappedBy = "putInStorageByInStorageId")
    public Collection<PutInStorageDetails> getPutInStorageDetailsByInStorageId() {
        return putInStorageDetailsByInStorageId;
    }

    public void setPutInStorageDetailsByInStorageId(Collection<PutInStorageDetails> putInStorageDetailsByInStorageId) {
        this.putInStorageDetailsByInStorageId = putInStorageDetailsByInStorageId;
    }
}
